<?php

namespace App\Web\Controllers;

use App\Http\Controllers\WebController;
use App\Services\FileService;

class UploadController extends WebController{

    protected $fileService;

    public function __construct(FileService $fileService){
        $this->fileService = $fileService;
    }

    /**
     * 单图上传
     * @return \Illuminate\Http\JsonResponse
     */
    public function upImg(){
        $resault = $this->fileService->uploads('image');
        $message = [
            'success' => $resault['status']?1:0,
            'message' => $resault['message'],
            'url' => empty($resault['url'][0])?'':$resault['url'][0]
        ];
        return response()->json($message);
    }
}